package com.example.weather_forecast;

import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class SevenDayForecastFragment extends BaseWeatherFragment {

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    protected void loadData() {
        // 模拟加载7天预报数据
        showLoading();
        List<WeatherData> sevenDayData = new ArrayList<>();
        for (int i = 0; i < 7; i++) {
            WeatherData data = new WeatherData("北京市", new Date(), "ic_cloudy", "22°C", "18°C~26°C", "多云");
            sevenDayData.add(data);
        }
        // 模拟网络请求延迟
        new Handler().postDelayed(() -> {
            showData(sevenDayData);
            // 可以在这里添加更新AQI视图的逻辑
        }, 2000);
    }
}